<MudTable @ref="_filteredTable" Items="_states" Filter="new Func<string, bool>(FilterFunc)">
     <ToolBarContent>
        <MudText>Filtered Item Count: @FilteredItemCount</MudText>
        <MudSpacer />
        <MudTextField id="searchString" @bind-Value="_searchString" Placeholder="Search"></MudTextField>
    </ToolBarContent>
    <RowTemplate>
        <MudTd>@context</MudTd>
    </RowTemplate> 
    <PagerContent>
        <MudTablePager PageSizeOptions="new int[] {10, 25, int.MaxValue }" />
    </PagerContent>
</MudTable>

@code {
    public static string __description__ = "paging test with filtering";

    private string? _searchString;
    private MudTable<string> _filteredTable = null!;

    private string FilteredItemCount => _filteredTable.GetFilteredItemsCount().ToString();

    private readonly string[] _states =
    [
        "Alabama", "Alaska", "American Samoa", "Arizona",
        "Arkansas", "California", "Colorado", "Connecticut",
        "Delaware", "District of Columbia", "Federated States of Micronesia",
        "Florida", "Georgia", "Guam", "Hawaii", "Idaho",
        "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky",
        "Louisiana", "Maine", "Marshall Islands", "Maryland",
        "Massachusetts", "Michigan", "Minnesota", "Mississippi",
        "Missouri", "Montana", "Nebraska", "Nevada",
        "New Hampshire", "New Jersey", "New Mexico", "New York",
        "North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio",
        "Oklahoma", "Oregon", "Palau", "Pennsylvania", "Puerto Rico",
        "Rhode Island", "South Carolina", "South Dakota", "Tennessee",
        "Texas", "Utah", "Vermont", "Virgin Island", "Virginia",
        "Washington", "West Virginia", "Wisconsin", "Wyoming"
    ];

    private bool FilterFunc(string state)
    {
        if (string.IsNullOrWhiteSpace(_searchString))
            return true;
        if (state.Contains(_searchString, StringComparison.OrdinalIgnoreCase))
            return true;
        return false;
    }
}
